<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input type="text" placeholder="id" readonly v-model=" product.id">
  <input type="text" placeholder="商品名" v-model=" product.title">
  <input type="text" placeholder="商品价格" v-model=" product.price">
  <input type="text" placeholder="商品销量" v-model=" product.saleCount">
  <input type="button" value="修改" @click="update()">
</div>
<script src="js/axios.min.js"></script>
<script src="js/vue.js"></script>
<script>
    let v =new Vue({
        el:"div",
        data:{
            product:{}
        },
        created:function () {
            let id = location.search.split("=")[1];
            axios.get("/selectById?id="+id).then(function (rs) {
                v. product = rs.data;
            })
        },
        methods:{
            update(){
             axios.post("/update",v.product).then(function (rs) {
                 alert("修改成功")
                 location.href="/list.html";
             })
            }
        }
    })
</script>
</body>
</html>